home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_serlib.sit
/
Serial Library Source Code
/
serial.open.dll.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-27
|
2KB
|
74 lines
/***********************************************************************/
/*
/* serial.open.dll.c
/* by Atul Butte
/* Copyright ⌐ 1989 by Microsoft Corporation
/* All Rights Reserved
/*
/* version 1.0
/*
/*
/* This CALL/REGISTER opens a serial port for communication.
/*
/* Excel usage:
/*
/* = Register( "serial library", "serial.open", "IH" )
/* = Call( ref, portNumber )
/*
/* where
/* portNumber = number of port (1 = modem, 2 = printer)
/*
/***********************************************************************/
/***********************************************************************/
/*
/* D E F I N E S
/*
/***********************************************************************/
#define ROUTINE_NAME "serial.open"
#define hNIL 0L
#define pNIL 0L
/***********************************************************************/
/*
/* I N C L U D E S
/*
/***********************************************************************/
#include "serial.h"
#include "error.h"
/***********************************************************************/
/*
/* main
/*
/***********************************************************************/
pascal short main( port )
unsigned short port; /* serial port to use */
{
register OSErr err; /* result code from Toolbox routines */
RememberA0();
SetUpA4();
if( port == 1 ) {
port = sPortA;
} else if( port == 2 ) {
port = sPortB;
} else {
display_error( "Illegal port number." );
RestoreA4( );
return( errInvalidPort );
}
err = RamSDOpen( port );
if( err != noErr ) {
display_error( "Error opening port." );
err = errSerialOpen;
}
RestoreA4( );
return( err );
}